MpegXtra® provides several functions that can be called from Lingo to control the playback of your Media files.
Cast Member Functions
addcuepoint(member x, cuepointtime, cuepointname) -- this function can be used to create a new cue point from Lingo. Cue points are automatically sorted for you.
Example: addcuepoint(member 2, 10500, "NewCue")
removecuepoint(member x, cuepointindex) -- this function can be used to remove a cue point. You should supply the index of the cue point to be removed.
Example: removecuepoint(member 2, 1)
getshortfilename(member x, longfilename) -- this function can be used to convert long filenames to short filenames, required by most MCI drivers.
scanfile(member x) -- this function can be used to extract the correct duration and dimensions of a video file when the linked media is changed via Lingo. The file is queried and the castmember properties are updated automatically. With MpegXtra 3.1 we introduced the adjustdurationbeforeplayback property, which also adjusts the duration, but does not impose and additional time penalty (the file is not opened twice), so it is generally better to leave it checked instead of using scanfile().
Example: scanfile(member 2)
register(member x, registration number) -- this function can be used in Projectors to register MpegXtra at runtime, and allow developers to save linked casts. It is not necessary for the normal operation of the Xtra.
Example: register(member 2, "SERIALNUMBERHERE")
Sprite Functions
videoplay (sprite x) -- used to start or resume playback of a Media file. Playback is usually started automatically when the sprite is loaded, unless the "Paused at Start" option is checked.
Example: videoplay(sprite 1)
videopause (sprite x) -- used to pause playback of a Media file.
Example: videopause(sprite 1)
videostop (sprite x) -- used to stop playback of a Media file. This is different from simply pausing, and some MPEG decoders require a full stop before a seek operation.
Example: videostop(sprite 1)
videoseek (sprite x, time) -- seeks the video to a different time in the Media file, and pause the video. Time should be expressed in frames.
Example: videoseek(sprite 1, 320)
videoplaysegment(sprite x, starttime, endtime) -- plays a segment of the Media file.
Example: videoplaysegment(sprite 1, 100,200)
videoplayfrom(sprite x, starttime) -- plays a the Media file starting from the point specified.
Example: videoplayfrom(sprite 1, 100)
isPastCuePoint(sprite x, cuepointindex) -- returns TRUE if the cue point indicated has already passed, FALSE otherwise.